#!/bin/bash
pid=`ps axu | grep "java" | grep -v "grep" | awk '{print $2}'`
for evry_pid in ${pid}
do
        exe_path=`ls -l /proc/${evry_pid} | grep "exe ->" | grep -v "grep" | awk '{print $NF}'`
        cwd_path=`ls -l /proc/${evry_pid} | grep "cwd ->" | grep -v "grep" | awk '{print $NF}'`
        pid_name=`ps ${evry_pid} | grep -v "grep" | awk '{print $NF}'`
        if [[ `ps ${evry_pid} | grep -i "tomcat" | grep -v "grep"` != "" ]]
        then
                pid_name="tomcat"
        elif [[ `ps ${evry_pid} | grep -i "resin" | grep -v "grep"` != "" ]]
        then
                pid_name="resin"
        fi
        echo ${evry_pid}:${pid_name}
        echo "exe_path:"${exe_path}
        echo "cwd_path:"${cwd_path}

done

